package senior.ListExer.Exer2;


import java.util.Scanner;

/**
 * @author shkstart
 * @creat 2022-04-14:20
 */
public class FirmTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Firm firm = new Firm("远方集团", "244345", "合肥瑶海区", "餐饮、房地产、娱乐");
        System.out.println(firm.toString());
        a:
        while (true) {
            System.out.println("1.新增员工\t2.开除员工\t3.查看员工信息");
            System.out.print("请选择：(输入0退出)");
            switch (sc.nextInt()) {
                case 1: {
                    System.out.println("姓名：");
                    String name = sc.next();
                    System.out.println("工号：");
                    String no = sc.next();
                    System.out.println("工资：");
                    int salary = sc.nextInt();
                    Employee employee = new Employee(name, no, salary);
                    boolean b = firm.addEmployee(employee);
                    if (b) {
                        System.out.println("添加成功");
                    } else {
                        System.out.println("添加失败");
                    }
                    break;
                }
                case 2: {
                    System.out.println("想要删除的员工工号：");
                    String no = sc.next();
                    boolean b = firm.deleteEmployee(no);
                    if (b) {
                        System.out.println("删除成功");
                    } else {
                        System.out.println("删除失败");
                    }
                    break;
                }
                case 3: {
                    firm.showEmployee();
                    break;
                }
                case 0: {
                    System.out.println("退出程序");
                    break a;
                }
            }
        }
    }
}
